﻿#region Header

// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------

#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.Threading;

#endregion

namespace ScrumTable.Common.Threading
{
    /// <summary>
    /// This delegate is used in order to notify users about an error in the
    /// threading layer.
    /// </summary>
    /// <param name="sender">Object which has fired the event.</param>
    /// <param name="args">Arguments which will be passed to the receiver.</param>
    public delegate void ThreadingEventHandler(object sender, ThreadingErrorEventArgs args);


    /// <summary>
    /// Provides arguments in conjunction with the ThreadingEventHandler.
    /// </summary>
    public class ThreadingErrorEventArgs : EventArgs
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Error which has been fired.
        /// </summary>
        public ThreadingException Error { get; private set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new ThreadingErrorEventArgs with an Exception.
        /// </summary>
        /// <param name="error">Error which has been thrown.</param>
        public ThreadingErrorEventArgs(ThreadingException error)
        {
            PreCondition.AssertNotNull(error, "error");

            Error = error;
        }

        #endregion
    }
}
